<layout name='Layout/layout_page' />
<script type="text/javascript">
	$(document).ready(function(){
		$('.nav li a').click(function(){
			$("#style").val($(this).attr('type'));
		})
	})
</script>
	
	<ol class="breadcrumb">
		<li><a href="<{:U('Ad/index')}>">运营管理</a></li>
      	<li><a href="<{:U('Ad/index')}>"></a>广告管理</li>
      	<li class="active">添加</li>
    </ol>

	<form id="ajaxForm" action="<{:U('Ad/save')}>" method="post" class="form-horizontal form-validata">
		<div class="form-group">
			<label class="col-md-1 control-label" for="name">名称：</label>
			<div class="col-md-11">
				<input type="text"
                class="form-control"
				name="name"
				id="name"
				data-rule-required="true"
				/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label" for="name">分类：</label>
			<div class="col-md-11">
				<select name="adtype" id="adtype" data-rule-required="true" class="form-control">
					<option value="">==请选择==</option>
					<volist name="adtype" id="vo">
					<option value="<{$vo.id}>"><{$vo.name}></option>
					</volist>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label" for="name">广告内容：</label>
			<div class="col-md-11">
				<ul class="nav nav-tabs">
				  <li class="active"><a href="#tab1" data-toggle="tab" type="1">图片</a></li>
				  <li><a href="#tab2" data-toggle="tab" type="2">flash</a></li>
				  <li><a href="#tab3" data-toggle="tab" type="3">文字</a></li>
				  <li><a href="#tab4" data-toggle="tab" type="4">代码</a></li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane active" id="tab1">
						<p></p>
						<div class="form-group">
							<label class="col-md-1 control-label" for="name">图片地址</label>
							<div class="col-md-5">
								<input type="text" name="imageUrl" id="imageUrl" class="form-control"/>
							</div>
							<div class="col-md-2">
								<input type="button" value="上传" class="btn btn-info btn-sm" onclick="uploadImage( '<{:U('Admin/Upload/singleImage')}>' , 'imageUrl')"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">链接地址</label>
							<div class="col-md-5">
								<input type="text" name="imageLink" data-rule-url="true" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">图片宽度</label>
							<div class="col-md-5">
								<input type="text" name="imageWidth" data-rule-number="true" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">图片高度</label>
							<div class="col-md-5">
								<input type="text" name="imageHeight" data-rule-number="true" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="tab-pane" id="tab2">
						<p></p>
						<div class="form-group">
							<label class="col-md-1 control-label" for="name">flash地址</label>
							<div class="col-md-5">
								<input type="text" name="flashUrl" id="flashUrl" class="form-control"/>
							</div>
							<div class="col-md-2">
								<input type="button" value="上传" class="btn btn-info btn-sm" onclick="uploadImage( '<{:U('Admin/Upload/singleImage')}>' , 'flashUrl')"/>
							</div>
						</div>	

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">flash宽度</label>
							<div class="col-md-5">
								<input type="text" name="flashWidth" data-rule-number="true" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">flash高度</label>
							<div class="col-md-5">
								<input type="text" name="flashHeight" data-rule-number="true" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="tab-pane" id="tab3">
						<p></p>
						<div class="form-group">
							<label class="col-md-1 control-label" for="name">文字内容</label>
							<div class="col-md-5">
								<input type="text" name="text" id="text" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">文字链接</label>
							<div class="col-md-5">
								<input type="text" name="link" data-rule-url="true" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">文字颜色</label>
							<div class="col-md-5">
								<input type="text" name="color" class="form-control"/> 如：#ff0000,red
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">文字大小</label>
							<div class="col-md-5">
								<input type="text" name="size" class="form-control"/> 如：12px、14px等
							</div>
						</div>
					</div>
					<div class="tab-pane" id="tab4">
						<p></p>
						<textarea name="htmlcode" id="" class="form-control areatext"></textarea> 支持html代码
					</div>
				</div>
			</div>			
		</div>		
		<div class="form-group">
			<label class="col-md-1 control-label" for="sort">排序：</label>
			<div class="col-md-2">
				<input type="text"
                class="form-control"
				name="sort"
				id="sort"
				data-rule-required="true"
				data-rule-number="true"
				value = "1"
				/>
				<p>数字越小越靠前</p>
			</div>
		</div>
		<div class="form-group">
			<div class="col-md-11 col-sm-offset-1">
				<button type="submit" class="btn btn-info">添加</button>
			</div>
		</div>
		<input type="hidden" name="style" id="style" value="1" />
	</form>

<input type="hidden" id="menu_action" value="ad" />
